<template>
  <view class="bill-content-wrap">
    <view class="bill-content-left">
      <view class="vip-card " v-if="curMemberInfo&&curMemberInfo.id">
        <view class="vip-card-left">
          <image src="/static/icons/vip.png" mode="aspectFit" class="vip-icon"></image>
          <text>{{curMemberInfo.member_level||'普通会员'}}</text>
        </view>
        <view class="vip-card-right">
          <text>{{curMemberInfo.member_phone||'-'}}</text>
          <image class="icon" src="/static/icons/exit.png" mode="" @click="exitMember"></image>
        </view>
        <view class="vip-card-left-bottom">
          <text>会员折扣：{{discountText||''}} </text>
          <text>余额：{{curMemberInfo.balance||'0'}} </text>
          <text>积分：{{curMemberInfo.integral||'0'}} </text>
        </view>
      </view>
      <view class="vip-card" v-else>
        <view class="vip-card-left">
          <image src="/static/icons/vip.png" mode="aspectFit" class="vip-icon"></image>
          <text>暂无会员</text>
        </view>
        <view class="vip-card-right" @click="showMemberSelector">
          <text>选择会员</text>
          <text class="cuIcon-right margin-left"></text>
        </view>
      </view>
      <view class="bill-title">
        <view class="">
          选择优惠
        </view>
      </view>
      <view class="change-price-box flex justify-between">
        <button class="button  line-white" @click="showPopup('手动打折')"
          :class="{'light border':activeButton==='手动打折'}">整单手动打折/改价</button>
        <button class="button  line-white" @click="showPopup('免单')"
          :class="{'light border':activeButton==='免单'}">免单</button>
        <button class="button line-white" @click="showPopup('会员价')" :class="{'light border':activeButton==='会员价'}"
          v-if="curMemberInfo&&curMemberInfo.id">会员价</button>
      </view>
      <view class="" v-if="curMemberInfo&&curMemberInfo.id">
        <view class="bill-title ">
          优惠券折扣
        </view>
        <view class="padding bg-green light radius flex align-center justify-between flex-1"
          style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" v-if="curCouponInfo&&curCouponInfo.id"
          @click="openSelectCoupon()">
          <text class="text-bold flex-1"
            style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{curCouponInfo.coupon_title||''}}</text>
          <text class=" flex padding-left align-center justify-end">
            <!--    <text class="" v-if="curCouponInfo.discount_num">
              {{curCouponInfo.discount_num}}折
            </text>
            <text class="" v-if="curCouponInfo.discount_amount">
              -{{curCouponInfo.discount_amount}}元
            </text> -->
            <text v-if="billResult&&billResult.coupon_discount">{{billResult.coupon_discount}}元</text>
            <!--  <text>{{curCouponInfo.coupon_type||''}}</text>
            <text
              v-if="curCouponInfo.use_threshold==='最低消费'&&curCouponInfo.min_consumption">(最低消费{{curCouponInfo.min_consumption}}元)</text>
            <text v-if="curCouponInfo.use_threshold==='无门槛'">(无门槛使用)</text> -->
          </text>
          <text class=""><text class="cuIcon-right"></text> </text>
        </view>
        <button class="coupon-code-box button" @click="openSelectCoupon()" v-else>
          <image src="/static/icons/coupon.png" mode="" style="width: 6rem;height: 6rem;margin-right: 1rem;"></image>
          <text>选择优惠券</text>
          <!--  <input type="text" class="coupon-code-input" />
          <view class="coupon-code-icon">
            <text class="cuIcon-barcode margin-right"></text>
            扫码
          </view> -->
        </button>
      </view>
      <!--  <view class=""
        v-if="!billResult._useCoupon && billResult&&billResult._activities&&billResult._activities.length>0"> -->
      <view class="">
        <view class="bill-title ">
          参与促销
        </view>
        <button class="coupon-code-box button" @click="openSelectPromotion()" v-if="!curPromotion">
          <image src="/static/icons/coupon.png" mode="" style="width: 6rem;height: 6rem;margin-right: 1rem;"></image>
          <text>选择促销活动</text>
        </button>
        <view class="padding bg-green light radius flex justify-between align-center"
          style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" v-else @click="openSelectPromotion()">
          <text class="margin-right text-left text-bold flex-1 "
            style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
            {{curPromotion.promotion_name||''}}</text>
          <text class="margin-left" v-if="curPromotion._discount_total_amount">
            {{setMoneyStr(curPromotion._discount_total_amount)}}</text>
          <text class=" "><text class="cuIcon-right"></text> </text>
        </view>
      </view>

      <view class="flex flex-1 align-end   justify-center padding-tb">
        <button class="button line-white" @click="cancel">取消</button>
      </view>
    </view>
    <view class="bill-content-right">
      <view class="integral-discount padding bg-yellow light radius"
        v-if="maxUseIntegral&&curMemberInfo&&curMemberInfo.integral&&integralSetting&&integralSetting.enable_member_integral==='是'&&integralSetting.integral_deduction==='启用'">
        <view class="flex align-center justify-between text-black">
          <view class="flex align-center">
            <view> 积分抵扣 <field-explain :text="integralSettingText"></field-explain>
            </view>
            <uni-easyinput style="width: 20rem;margin-left: 2rem;" primaryColor="#38C09E" v-model="usedIntegral"
              placeholder="请输入" type="number" @change="changeUseIntegral" @clear="changeUseIntegral(0)" />
          </view>
          <view class=" ">
            <button class="button light round" @click="useAllIntegral">全部使用</button>
          </view>
        </view>
        <view class="" v-if="curMemberInfo.integral < usedIntegral">
          超出可用积分上限
        </view>
        <view class="" v-else-if="usedIntegral > maxUseIntegral">
          当前订单最多可用{{maxUseIntegral}}积分
        </view>
        <view class="text-black padding-top">
          当前积分：{{curMemberInfo.integral||'0'}}，本单最多抵扣{{integralSetting.max_integral_deduction}}%，使用{{usedIntegral}}积分抵扣：￥{{usedIntegral/integralSetting.satisfy_deduction_integral}}
        </view>
      </view>
      <view class="bill-title">
        账单明细
      </view>
      <view class="detail-list">
        <view class="detail-list-item">
          <view class="label">
            商品
            <text v-if="refundMode===true">退款</text>
            <text v-else>价格</text>
            合计
          </view>
          <view class="value">
            ￥ <text v-if="billResult.order_total_amount===0">0</text><text
              v-else>{{billResult.order_total_amount||''}}</text>
          </view>
        </view>
        <view class="detail-list-item" v-if="orderInfo&&orderInfo.pay_amount">
          <view class="label">
            已支付
          </view>
          <view class="value">
            ￥{{orderInfo.pay_amount||setHasPay||'0'}}
          </view>
        </view>
        <view class="detail-list-item" v-if="billResult.discount_reduction_amount">
          <view class="label">
            整单改价
          </view>
          <view class="value">
            -￥{{ -billResult.discount_reduction_amount||'0'}}
          </view>
        </view>


        <view class="detail-list-item" v-if="billResult.coupon_discount">
          <view class="label">
            优惠券优惠
          </view>
          <view class="value">
            -￥{{-billResult.coupon_discount||'0.00'}}
          </view>
        </view>

        <view class="detail-list-item" v-if="billResult.discount_full_decrement">
          <view class="label">
            促销-满额减现
          </view>
          <view class="value">
            -￥{{-billResult.discount_full_decrement||'0'}}
          </view>
        </view>


        <view class="detail-list-item" v-if="billResult.discount_direct">
          <view class="label">
            促销-直接折扣
          </view>
          <view class="value">
            -￥{{-billResult.discount_direct||'0'}}
          </view>
        </view>

        <view class="detail-list-item" v-if="billResult.member_discount">
          <view class="label">
            会员优惠
          </view>
          <view class="value">
            -￥{{-billResult.member_discount||'0'}}
          </view>
        </view>

        <view class="detail-list-item" v-if="billResult.free_discount_amount">
          <view class="label">
            免单优惠
          </view>
          <view class="value">
            -￥{{ -billResult.free_discount_amount||'0'}}
          </view>
        </view>

        <view class="detail-list-item" v-if="billResult.integral_deduction">
          <view class="label">
            积分抵扣
          </view>
          <view class="value">
            -￥{{-billResult.integral_deduction||'0.00'}}
          </view>
        </view>

        <view class="detail-list-item" v-if="billResult.cash_reduction_amount">
          <view class="label">
            抹零金额
          </view>
          <view class="value">
            -￥{{-billResult.cash_reduction_amount||'0.00'}}
          </view>
        </view>

        <view class="detail-list-item border-top">
          <view class="label ">
            <text v-if="refundMode===true">待退</text>
            <text v-else>应收</text>
          </view>
          <view class="value text-red flex align-center ml-box">
            <text class="text-red  price">￥{{billResult.order_amount||'0.00'}}</text>
            <zb-tooltip placement="bottom-end" ref="tooltipRef" color="white" :visible="mlVisible" v-if="!setWaitPay">
              <button @click="clickMlButton" class="button light sm margin-left">抹零</button>
              <template #content>
                <view class="ml-content">
                  <view @click="ml(`mj`)" class="row">
                    抹角 :{{mjTip}}
                  </view>
                  <view @click="ml(`my`)" class="row">
                    抹元 :{{myTip}}
                  </view>
                  <view @click="isInput = true;mlVisible=false;" class="row no-border">
                    任意金额
                  </view>
                </view>
              </template>
            </zb-tooltip>
          </view>
        </view>
      </view>
      <view class="flex-1 flex flex-column justify-center">
        <view class="bill-title">
          <view>
            <text>选择</text>
            <text v-if="refundMode===true">退款</text>
            <text v-else>支付</text>
            <text>方式</text>
          </view>
        </view>
        <view class="payment-grid">
          <view class="payment-item"
            :class="{disabled:(billResult._order_amount===0&&item.label!=='现金支付')||item.disabled == true||item.label==='会员支付'&&(!curMemberInfo||!curMemberInfo.id)}"
            @click="selectPayment(item.label)" v-for="item in paymentList">
            <image :src="item.image" mode="aspectFit"></image>
            <text class="payment-item-label">{{item.label}}</text>
          </view>
        </view>
      </view>

    </view>

    <!-- 弹窗 -->
    <view class="custom-center-popup top">
      <u-popup :show="showForm" :round="20" mode="center" :overlay="true" :closeable="true" :closeOnClickOverlay="false"
        @close="showForm=false;onSelectCoupon=true;">
        <view class="popup-title">
          优惠券详情
        </view>
        <bx-form style="padding-top:0;" :disabled="true" :serviceName="formService" :appName="formApp" :type="formType"
          :pkCol="formIdCol" :pk="formId" @cancel="showForm = false">
        </bx-form>
      </u-popup>
    </view>
    <view class="custom-center-popup">
      <u-popup :show="showWindow" zIndex="999999999" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="$emit(`update:showWindow`,false)">
        <view style="padding:35px;">
          <view style="
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					height: 14rem;
					font-size: 4rem;
					font-weight: 600;
					">
            请用扫描设备扫描支付二维码
          </view>
          <view style="margin-bottom: 32px;">
            <u-input :disabled="true" :focus="codeInputFocus" @blur="codeInputBlur"
              :customStyle="{height:`6.8rem !important`}" placeholder="请扫支付码" border="surround" v-model="codeInputValue"
              ref="codeInput"></u-input>
          </view>
        </view>
      </u-popup>

      <u-popup title="手动抹零" :show="isInput" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="isInput = false">
        <view class="popup-title">
          手动抹零金额
        </view>
        <view style="padding:0 3rem 3rem 3rem;width: 50rem;">
          <view style="margin-top: 10px; text-align: right;">
            <uni-easyinput primaryColor="#38C09E" inputAlign="right" type="number" v-model="mlInput"
              placeholder="请输入大于零的数字" @change="changeML" @input="changeML" :maxlength="10" />
          </view>

          <view style="margin-top: 15px;display: flex;align-items: center;width: 100%;justify-content: center;
					    font-size: 18px;
					    font-weight: 700;">
            <view>抹零后应收 <text style="color: #e54d42;" class="red">￥{{mlje}}</text></view>
          </view>

          <view style="width: 100%;margin-top: 20px;">
            <u-button @click="ml(`ry`)" :customStyle="{
								 width: `100%`,
								borderRadius: `10px`,
								    background: `rgb(56, 192, 158)`,
								    border: `1px solid rgb(229, 229, 229)`,
								    color: `white`
							 }" text="提交"></u-button>
          </view>
        </view>
      </u-popup>

      <u-popup :show="onManualDisaccount" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="onManualDisaccount = false">
        <manual-disaccount @cancle="canclePopup" @confirmManualDisaccount="confirmManualDisaccount"
          :billResult="billResult" :noPayAmount="noPayAmount"> </manual-disaccount>
      </u-popup>

      <u-popup :show="onFreeOrder" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="onFreeOrder = false;activeButton=''">
        <free-order @cancle="canclePopup" @confirmFreeOrder="confirmFreeOrder" :noPayAmount="noPayAmount"></free-order>
      </u-popup>

      <!-- 现金支付弹窗 -->
      <u-popup :show="onCashPay" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="closeCashPayPopup">
        <cash-pay-popup :noPayAmount="noPayAmount" @confirm="confirmPay"></cash-pay-popup>
      </u-popup>
      <u-popup :show="onPayFail" :round="20" mode="center" :overlay="true" :closeable="false"
        :closeOnClickOverlay="false" @close="closePopup('onPayFail')">
        <view class="success-pay">
          <view class="title">
            支付失败
          </view>
          <image class="image" src="/static/images//fail-pay.png" mode="aspectFill"></image>
          <view class="flex-1">
            支付出现问题，请尝试重新支付
          </view>
          <view class="button-box">
            <button class="button lg full" @click="payOrder()">重新支付</button>
          </view>
        </view>
      </u-popup>
      <u-popup :show="onPaySuccess" :round="20" mode="center" :overlay="true" :closeable="false"
        :closeOnClickOverlay="false" @close="closePopup('onPaySuccess')">
        <view class="success-pay">
          <view class="title">
            <view class="">
              <text v-if="refundMode===true">退款</text>
              <text v-else>支付</text>
              成功
            </view>
          </view>
          <image class="image" src="/static/images/success-pay.png" mode="aspectFill"></image>
          <view class="">
            <text v-if="refundMode===true">实退</text>
            <text v-else>实收</text>金额
          </view>
          <view class="pay-amount">
            ￥{{billResult._order_amount||'0'}}
          </view>
          <view class="bottom">
            <view class="bottom-item" v-for="item in successPayItem" v-if="billResult[item.col]">
              <text>{{item.label}}：</text> <text class="money">{{setMoneyStr(billResult[item.col])}}</text>
            </view>
            <!-- <view class="bottom-item">
              <text>商品小计：</text> <text class="money">{{setMoneyStr(billResult.order_total_amount)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.discount_reduction_amount">
              <text>整单改价：</text> <text class="money">{{setMoneyStr(billResult.discount_reduction_amount)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.member_discount">
              <text>会员优惠：</text> <text class="money">{{setMoneyStr(billResult.member_discount)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.free_discount_amount">
              <text>免单优惠：</text> <text class="money">{{setMoneyStr(billResult.free_discount_amount)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.discount_direct">
              <text>促销-直接折扣：</text> <text class="money">{{setMoneyStr(billResult.discount_direct)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.discount_full_decrement">
              <text>促销-满额减现：</text> <text class="money">{{setMoneyStr(billResult.discount_full_decrement)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.integral_deduction">
              <text>积分抵扣：</text> <text class="money">{{setMoneyStr(billResult.integral_deduction)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.coupon_discount">
              <text>优惠券优惠：</text> <text class="money">{{setMoneyStr(billResult.coupon_discount)}}</text>
            </view>
            <view class="bottom-item" v-if="billResult.cash_reduction_amount">
              <text>抹零金额：</text> <text class="money">{{setMoneyStr(billResult.cash_reduction_amount)}}</text>
            </view> -->
          </view>
          <view class="button-box">
            <button class="button lg full" @click="successPay">确定</button>
          </view>
          <view class="margin-tb text-grey">
            <text>系统将在</text>
            <text class="text-red"> {{timeoutSecond}} </text>
            <text>秒后进行跳转</text>
          </view>
        </view>
      </u-popup>

      <!-- 会员组合支付 -->
      <u-popup zIndex="11" class="combinedPayment" :show="popupName==='combinedPayment'" :round="20" mode="center"
        :overlay="true" :closeable="true" :closeOnClickOverlay="false" @close="hideCombinedModal()"
        v-if="curMemberInfo&&curMemberInfo.balance">
        <view class="popup-title">
          选择组合支付方式
        </view>
        <view class="combine-payment">
          <view class="combine-payment-left">
            <view class="combine-payment-top">
              <view class="combine-payment-item">
                <image src="/static/icons/hyzf.png" mode="aspectFit" class="image"></image>
                <text class="label">会员支付</text>
              </view>
              <view class="combine-payment-item" style="font-size: 4rem;">
                <text class="cuIcon-roundadd  text-gray"></text>
              </view>
            </view>
            <view class="combine-payment-center">
              <view class="combine-payment-item"
                :class="{disabled:item.disabled == true,active:item.label===curCombinePayment}"
                v-for="item in paymentList.filter(item=>item.label!=='会员支付')" @click="selectPayment(item.label)">
                <image :src="item.image" mode="aspectFit" class="image"></image>
                <text class="label">{{item.label}}</text>
              </view>
            </view>
            <view class="text-gray margin-left padding">
              请再选一个支付方式 剩余 ￥{{billResult._vip_pay_order_amount}}
            </view>
          </view>
          <view class="combine-payment-right">
            <view class="title ">
              账单应收
            </view>
            <view class="pay-result-item">
              <text class="label">应收：</text>
              <text class="text-bold">￥{{billResult._order_amount}}</text>
            </view>
            <view class="pay-result-item border-top-dashed">
              <text class="label">会员收款：</text>
              <text>￥{{billResult._vip_pay_amount}}</text>
            </view>
            <view class="pay-result-item ">
              <text class="label">剩余应收：</text>
              <text>￥{{billResult._vip_pay_order_amount}}</text>
            </view>
            <view class="pay-result-item border-top-dashed">
              <text class="label">实际收款：</text>
              <text class="text-red text-bold">￥{{billResult._order_amount}}</text>
            </view>
          </view>
          <view class="combine-payment-bottom">
            <button class="line-white button " @click="hideCombinedModal">取消</button>
          </view>
        </view>
      </u-popup>
      <u-popup :show="onSelectPromotion" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="onSelectPromotion=false">
        <view class="selector-view">
          <view class="popup-title">
            请选择促销活动
          </view>
          <promotion-selector @cancel="cancelSelectPromotion" :default="curPromotion||null"
            :list="billResult._promotionList" @confirm="confirmSelectPromotion"></promotion-selector>
        </view>
      </u-popup>
      <u-popup :show="onSelectCoupon" :round="20" mode="center" :overlay="true" :closeable="true"
        :closeOnClickOverlay="false" @close="onSelectCoupon=false">
        <view class="popup-title">
          请选择优惠券
        </view>
        <coupon-selector :list="couponList1" :list2="couponList2" :defaultId="curCoupon" @unuse="selectCoupon(false)"
          @confirm="selectCoupon" @cancel="onSelectCoupon=false"></coupon-selector>
      </u-popup>
    </view>
    <u-modal class="custom-u-modal" width="30vw" confirmColor="#38C09E" :show="showVipPayModal" title="会员余额支付"
      confirmText="组合付款" :showCancelButton="true" @confirm="useVipPay(true)" @cancel="hideVipPayModal"
      v-if="showVipPayModal&&combinedPayment">
      <view class="detail-list" style="width: 100%;">
        <view class="detail-list-item " v-if="billResult._order_amount">
          <view class="label">
            账单应付
          </view>
          <view class="value">
            ￥{{billResult._order_amount||''}}
          </view>
        </view>
        <view class="detail-list-item text-red" v-if="curMemberInfo&&curMemberInfo.balance">
          <view class="label">
            会员余额
          </view>
          <view class="value">
            ￥{{curMemberInfo.balance||''}}
          </view>
        </view>
        <view class="tips text-yellow text-sm"
          v-if="curMemberInfo&&curMemberInfo.balance&&curMemberInfo.balance-billResult._order_amount<0">
          提示：点击【组合支付】，系统将扣除会员余额
        </view>
      </view>
    </u-modal>
    <u-modal class="custom-u-modal" width="30vw" confirmColor="#38C09E" :show="showVipRefundModal" title="退款至会员余额"
      confirmText="确认退款" :showCancelButton="true" @confirm="useVipPay" @cancel="showVipRefundModal=false"
      v-else-if="showVipRefundModal">
      <view class="detail-list" style="width: 100%;">
        是否确认给会员【{{curMemberInfo.member_name}}】退款 <text class="text-red"> {{billResult._order_amount}} </text> 元？
      </view>
    </u-modal>
    <u-modal class="custom-u-modal" width="30vw" confirmColor="#38C09E" :show="showVipPayModal" title="会员余额支付"
      confirmText="会员余额结账" :showCancelButton="true" @confirm="useVipPay" @cancel="hideVipPayModal"
      v-else-if="showVipPayModal">
      <view class="detail-list" style="width: 100%;">
        <view class="detail-list-item text-red" v-if="billResult._order_amount">
          <view class="label">
            应收
          </view>
          <view class="value">
            ￥{{billResult._order_amount||''}}
          </view>
        </view>
        <view class="detail-list-item">
          <view class="label">
            原价
          </view>
          <view class="value">
            ￥{{billResult.order_total_amount||''}}
          </view>
        </view>
        <view class="detail-list-item" v-if="billResult.discount_amount">
          <view class="label">
            打折/优惠
          </view>
          <view class="value">
            -￥{{-billResult.discount_amount||''}}
          </view>
        </view>
      </view>
    </u-modal>
    <u-modal class="custom-u-modal" width="35vw" confirmColor="#38C09E" :show="popupName==='validVipCode'"
      title="会员余额支付" :showCancelButton="true" @confirm="validVipPayCode()" @cancel="closePopup()"
      v-if="popupName==='validVipCode'">
      <view class="vip-code-input">
        <view class="flex align-center">
          <view class="label">
            <text class="text-red">*</text> 验证码：
          </view>
          <uni-easyinput type="number" primaryColor="#38C09E" v-model="vipPhoneCode" placeholder="输入验证码" />
        </view>
        <view class="hint">
          请输入该会员的手机验证码
        </view>
      </view>
    </u-modal>

    <u-modal class="custom-u-modal" width="35vw" confirmColor="#38C09E" :show="showConfirmPayModal" title="现金支付/线下支付"
      content='请确认是否已完成支付!如点击确认,该订单将无法更换其他支付方式支付。' :showCancelButton="true" @confirm="createOrder"
      @cancel="hideConfirmPayModal" v-if="showConfirmPayModal">
    </u-modal>

  </view>
</template>

<script>
  import calcBillResult2, {
    calcNeedInputIntegral
  } from '@/common/utils/calcBillResult.js'
  import {
    createOrder,
    mobilePay,
    payOrder,
    getOrderDetail,
    refreshOrderState
  } from '@/common/api/order.js'
  export default {
    // 结算界面
    name: "bill-content",
    props: {
      refundMode: {
        type: Boolean,
        default: false
      },
      mode: {
        type: String
      },
      orderNo: {
        type: String
      },
      cartInfo: {
        type: Object
      },
      remark: {
        type: String
      },
      showWindow: {
        type: Boolean
      },
      uuid: {
        type: String
      },
      codePayString: {
        type: [String, Boolean]
      },
      initPromotion: {
        type: Object
      },
      initCoupon: {
        type: [String, Number]
      },
      payWayList: {
        type: Array
      }
    },
    async created() {
      if (this.initPromotion) {
        this.curPromotion = this.initPromotion
      }
      if (this.initCoupon) {
        this.curCoupon = this.initCoupon
      }
      if (this.cartInfo) {
        if (this.orderNo) {
          this.orderInfo = await getOrderDetail(this.orderNo)
          if (this.orderInfo?.cartData) {
            const cartInfo = {
              _id: `cartInfo_${new Date().getTime()}`,
              cart: this.orderInfo?.cartData
            }
            this.$emit('change-cart', cartInfo)
          }
        }

        this.$nextTick(() => {
          this.calcBillResult()
        })
      }

      if (Array.isArray(this.payWayList) && this.payWayList.length > 0) {
        this.paymentList = this.payWayList
      } else {
        this.getPayWayList()
      }
    },
    computed: {
      couponList1() {
        return this.couponList.filter(item => {
          if (item.useable_state == '不可用') {
            return false
          }
          if (item.use_threshold === "最低消费" && item.min_consumption && this.billResult
            .order_total_amount < item
            .min_consumption) {
            return false
          }
          if (item.available_start_time && item.available_end_time) {
            return new Date(item.available_start_time) <= new Date() && new Date() <= new Date(item
              .available_end_time)
          }
          return true
        })
      },
      couponList2() {
        return this.couponList.map(item => {
          if (item.use_threshold === "最低消费" && item.min_consumption && this.billResult
            .order_total_amount < item
            .min_consumption) {
            item._type = '本单不可用'
          }
          if (item.available_start_time && item.available_end_time) {
            if (new Date(item.available_start_time) > new Date()) {
              item._type = '不在可用时间范围内'
            }
            if (new Date() > new Date(item.available_end_time)) {
              item._type = '已过期'
            }
          }
          if (item.useable_state == '不可用') {
            item._type = '本单不可用'
          }
          return item
        }).filter(item => !!item._type)
      },
      enableMemberDiscount() {
        return this.$store?.state?.$integralSetting?.enable_member_discount === '是'
      },
      discountText() {
        if (!this.enableMemberDiscount) {
          return '未启用'
        }
        let text = '-'
        const rate = this.curMemberInfo?.discount_rate
        const discount_type = this.curMemberInfo?.discount_type
        if (discount_type) {
          if (rate && discount_type.indexOf('打折') !== -1 && discount_type.indexOf('优惠价') !== -1) {
            text = `${rate}%或优惠价`
          } else if (discount_type.indexOf('打折') !== -1 && rate) {
            text = `${rate}%`
          } else if (discount_type.indexOf('优惠价') !== -1) {
            text = '优惠价'
          }
        }
        return text
      },
      integralSettingText() {
        if (this.integralSetting) {
          return `每${this.integralSetting.satisfy_deduction_integral}积分抵扣1元，请输入${this.integralSetting.satisfy_deduction_integral}的倍数`
        }
      },
      integralSetting() {
        return this.$store?.state?.$integralSetting
      },
      setWaitPay() {
        let res = 0
        let total = this.orderInfo?.wait_pay_amount
        if (total) {
          res = Number(Number(total - this.setHasPay || this.hasPay).toFixed(2))
        }
        return res >= 0 ? res : 0
      },
      setHasPay() {
        if (!isNaN(Number(this.hasPay))) {
          return Number(Number(this.hasPay * 10000).toFixed(2) / 10000)
        }
        return 0
      },
      actualPayAmount() {
        return this.orderInfo?.pay_amount
      },
      // 仍需支付、还未支付金额
      noPayAmount() {
        if (this.activeButton === '免单') {
          return 0
        }
      },
      mjTip() {
        if (this.billResult?._order_amount) {
          let numStr = `${Number(this.billResult._order_amount||0).toFixed(2)}`;
          let subIndex = numStr.indexOf(".");
          let resultNum = numStr.substr(subIndex, numStr.length - 1);
          return `0${resultNum}`;
        } else {
          return 0.00
        }
      },
      myTip() {
        if (this.billResult?._order_amount) {
          let numStr = `${Number(this.billResult?._order_amount).toFixed(2)}`;
          let subIndex = numStr.indexOf(".");
          return numStr.substr(subIndex - 1, numStr.length - 1);
        } else {
          return 0.00
        }
      },
      mlje() {
        let addNum;
        if (this.mlInput == '') {
          addNum = 0
        } else {
          addNum = this.mlInput;
        };
        let num = Number(addNum || 0);
        if (this.billResult?.cash_reduction_amount) {
          num = num + Number(this.billResult?.cash_reduction_amount || 0)
        }
        let result = (Number(this.billResult?._order_amount || 0) - num).toFixed(2);
        if (result < 0) {
          result = 0
        }
        return result;
      },
      maxUseIntegral() {
        return this.billResult._max_can_use_integral
      },
      curCouponInfo() {
        return this.curCoupon && this.couponList.find(item => item.id && item.id === this.curCoupon)
      },
    },
    watch: {
      curAssistant: {
        deep: true,
        handler(newValue) {
          if (!this.orderInfo?.order_no) {
            this.calcBillResult()
          }
        },
      },
      remark() {
        if (!this.orderInfo?.order_no) {
          this.calcBillResult()
        }
      },
      maxUseIntegral: {
        handler(newValue) {
          // if (newValue && this.usedIntegral > newValue) {
          if (!this.orderInfo?.order_no && newValue && this.usedIntegral > newValue) {
            this.usedIntegral = newValue
            this.changeUseIntegral(newValue)
          }
        }
      },
      curMemberInfo: {
        handler(newValue, oldValue) {
          if (newValue?.id && !this.activeButton) {
            // this.activeButton = '会员价';
          } else {
            // this.activeButton = '';
          }
          if (!this.orderInfo?.order_no && newValue?.id !== oldValue?.id) {
            this.initCalcBillResult()
          }
        }
      },
      uuid() {
        if (this.showWindow && this.codePayString && !this.paying) {
          console.log("我是扫码机");
          this.codeInputValue = this.codePayString;
          this.codeInputChange();
        }
      }
    },
    data() {
      return {
        curCouponType: 0,
        // setMoneyStr: setMoneyStr,
        timeoutSecond: '',
        curCombinePayment: "", //当前选择的组合支付方式
        paying: false,
        codeInputFocus: false,
        onSelectCoupon: false, // 选择优惠券弹窗
        onSelectPromotion: false, // 选择促销活动弹窗
        couponList: [],
        billResult: {},
        ml_amount: 0,
        vipPhoneCode: "",
        activeButton: '',
        popupName: "", // 弹窗名
        showConfirmPayModal: false, // 确认现金支付
        showVipPayModal: false, //会员价支付
        showVipRefundModal: false, //会员余额退款
        combinedPayment: false, //组合支付
        orderInfo: null,
        payInfo: null,
        freePayPopup: false, //显示免单弹框
        onCashPay: false, // 显示现金支付弹框
        onPaySuccess: false, // 显示支付成功弹窗
        onPayFail: false, // 显示支付失败弹窗 
        hasPay: 0, //已支付金额
        onManualDisaccount: false,
        onFreeOrder: false,
        mlInput: "",
        isInput: false,
        extraData: {
          disaccount: {},
          freeOrder: {},
          passData: {
            disaccount: {
              "discount_type": '不优惠',
              "discount_mode": '无',
              "discount_reduction_amount": 0,
              "discount_reason": '',
            }
          }
        },
        isZf: false,
        codeInputValue: '',
        payWay: '',
        random: '',
        paymentList: [],
        mlVisible: false, //显示抹零
        // mlje:''
        memberDetail: null,
        usedIntegral: 0, //使用积分
        curCoupon: "",
        showForm: false,
        formIdCol: "",
        formId: "",
        formType: "",
        formApp: "",
        formService: "",
        curPromotion: null, // 当前选择的促销活动
        successPayItem: [{
            label: '商品小计',
            col: 'order_total_amount'
          },
          {
            label: '整单改价',
            col: 'discount_reduction_amount'
          },
          {
            label: '会员优惠',
            col: 'member_discount'
          },
          {
            label: '免单优惠',
            col: 'free_discount_amount'
          },
          {
            label: '促销-直接折扣',
            col: 'discount_direct'
          },
          {
            label: '促销-满额减现',
            col: 'discount_full_decrement'
          },
          {
            label: '积分抵扣',
            col: 'integral_deduction'
          },
          {
            label: '优惠券优惠',
            col: 'coupon_discount'
          },
          {
            label: '抹零金额',
            col: 'cash_reduction_amount'
          },

        ]
      };
    },
    methods: {
      confirmSelectPromotion(e) {
        this.curPromotion = e;
        this.activeButton = ''
        this.curCoupon = ''
        this.onSelectPromotion = false
        this.usedIntegral = 0
        this.initCalcBillResult()
      },
      cancelSelectPromotion(e) {
        if (e === 'cancel') {
          this.curPromotion = null
        }
        this.onSelectPromotion = false
        this.calcBillResult()
      },
      changeCouponType(e) {
        console.log(e);
        this.curCouponType = e
      },

      toCouponDetail(e) {
        this.formService = "srvmkt_member_coupon_available_two_select"
        this.formApp = "mkt"
        this.formType = "detail"
        // this.formId = e.id
        this.formId = e.id
        this.formIdCol = 'id'
        this.showForm = true
      },
      selectCoupon(item) {
        if (item._type) {
          uni.showToast({
            title: item._type,
            icon: 'none'
          })
          return
        }

        this.activeButton = ''
        this.curPromotion = null
        if (item === false) {
          this.curCoupon = ''
        } else if (this.curCoupon === item.id) {
          this.curCoupon = ''
        } else {
          this.curCoupon = item.id
        }
        this.onSelectCoupon = false
        this.usedIntegral = 0
        this.initCalcBillResult()
      },
      openSelectPromotion() {
        this.onSelectPromotion = true;
      },
      openSelectCoupon() {
        this.curCouponType = 0
        this.onSelectCoupon = true;
        this.getCouponList()
      },
      getCouponList(sev = 'srvmkt_member_coupon_available_select') {
        sev = 'srvmkt_member_coupon_available_two_select'
        let req = {
          "serviceName": sev,
          "colNames": ["*"],
          "condition": [{
              "colName": "member_no",
              "ruleType": "eq",
              "value": this.curMemberInfo?.menber_no
            },
            {
              colName: 'write_off_type',
              ruleType: 'ne',
              value: '已核销'
            }
          ],
          "page": {
            "pageNo": 1,
            "rownumber": 999
          }
        }
        if (this.curMemberInfo?.menber_no) {
          this.$fetch('select', sev, req, 'mkt').then((res) => {
            if (res.success) {
              // this.calcBillResult()
              this.couponList = res.data
            }
          })
        }
      },
      changeUseIntegral(e) {
        console.log('changeUseIntegral', e);
        if (e) {
          let num = Number(e)
          if (num > this.maxUseIntegral) {
            setTimeout(() => {
              this.usedIntegral = this.maxUseIntegral
              uni.showToast({
                title: `当前订单最多可用${this.maxUseIntegral}积分`,
                icon: "none"
              })
              this.calcBillResult()
            }, 100)
          } else {
            let res = calcNeedInputIntegral(this.integralSetting.satisfy_deduction_integral, num, this.maxUseIntegral)
            console.log(res);
            if (Number(res) !== Number(num)) {
              uni.showToast({
                title: `使用积分必须为${this.integralSetting.satisfy_deduction_integral}的整数倍`,
                icon: "none"
              })
            }
            setTimeout(() => {
              this.usedIntegral = res
              this.calcBillResult()
            }, 100)
          }

        } else {
          this.calcBillResult()
        }
      },
      useAllIntegral() {
        this.initCalcBillResult()
        this.usedIntegral = this.billResult._max_can_use_integral
        this.initCalcBillResult()
      },
      codeInputChange() {
        if (this.codeInputValue) {
          let valid = false
          let code = this.codeInputValue + ''
          if (this.payWay == '微信支付') {
            if (/^1[0-5]\d{16}$/.test(code)) {
              valid = true
            }
          } else if (this.payWay == '支付宝支付') {
            if (/^(?:2[5-9]|30)\d{14,22}$/.test(code)) {
              valid = true
            }
          } else if (this.payWay == '银联支付') {
            if (/^62\d{0,32}$/.test(code)) {
              valid = true
            }
          }
          if (valid === false) {
            this.$emit("update:showWindow", false)
            uni.showToast({
              title: '非' + this.payWay + '付款码',
              icon: 'none'
            })

            return
          }
        } else {
          return
        }
        this.paying = true;
        this.mobilePay()
      },
      clickMlButton() {
        this.ml_amount = 0
        this.calcBillResult()
      },
      codeInputBlur() {
        this.random = this.getUuid();
      },
      changeML(e) {
        if (Number(e) > this.billResult.order_amount) {
          uni.showToast({
            title: '抹零金额不得大于订单应付金额',
            icon: 'none'
          })
        }
      },
      ml(type) {
        this.mlVisible = false
        let price = this.billResult?._order_amount || 0
        if (this.billResult?.cash_reduction_amount) {
          price -= this.billResult?.cash_reduction_amount
        }
        if (type == 'mj') {
          this.ml_amount = Number(this.ml_amount) + Number(this.mjTip)
        } else if (type == 'my') {
          this.ml_amount = Number(this.ml_amount) + Number(this.myTip)
        } else if (type == 'ry') {
          if (this.mlInput < 0) {
            uni.showToast({
              duration: 2000,
              icon: "none",
              title: '请输入正整数'
            })
            return
          };
          if (this.mlInput > this.billResult.order_amount) {
            uni.showToast({
              duration: 2000,
              icon: "none",
              title: `抹零金额不得大于订单应付金额(￥${this.billResult.order_amount})`
            })
            return
          };
          this.ml_amount = Number(this.mlInput)
          this.isInput = false;
          this.mlInput = "";
        }
        if (!this.orderInfo?.order_no) {
          this.$nextTick(() => {
            this.calcBillResult()
          })
        }
      },
      canclePopup(e) {
        if (e == "freeOrder") {
          this.onFreeOrder = false;
          this.activeButton = ''
        } else if (e == "manualDisaccount") {
          this.activeButton = '';
          this.onManualDisaccount = false;
        }
      },
      enabledPayment(e) {
        if (this.orderInfo?.wait_pay_amount === 0) {
          return false
        }
        if (e === '现金支付') {
          return true
        } else if (e === '会员支付') {
          const balance = this.curMemberInfo?.balance;
          if (balance && balance > 0) {
            return true
          }
        } else {
          return true
        }
      },
      confirmManualDisaccount(data) {
        this.extraData.disaccount = data;
        this.extraData.passData.disaccount = data.passData;
        this.onManualDisaccount = false;
        this.initCalcBillResult()
      },
      confirmFreeOrder(data) {
        this.extraData.freeOrder = data;;
        this.extraData.passData.freeOrder = data;
        this.initCalcBillResult()
        this.onFreeOrder = false;
        console.log(data);
        debugger
        this.createOrder()
      },
      showPopup(e) {
        this.curCoupon = ''
        this.curPromotion = ''
        if (this.activeButton === e) {
          this.activeButton = '';
        } else {
          this.activeButton = e;
          if (e == "手动打折") {
            this.onManualDisaccount = true;
            return
          } else if (e == "免单") {
            this.onFreeOrder = true;
            return
          }
        }
        if (e) {
          this.initCalcBillResult()
        }
      },
      initCalcBillResult(type) {
        this.ml_amount = 0
        if (this.billResult?.cash_reduction_amount) {
          this.billResult.cash_reduction_amount = 0
        }
        if (this.billResult?._order_amount) {
          this.billResult._order_amount = 0
        }
        this.calcBillResult(type)
      },
      hideCombinedModal() {
        this.popupName = ''
        this.combinedPayment = false
        this.calcBillResult()
      },
      hideVipPayModal() {
        this.activeButton = ''
        this.showVipPayModal = false
      },
      hideConfirmPayModal() {
        this.showConfirmPayModal = false
      },
      successPay() {
        this.closePopup('onPaySuccess');
        this.$emit('success-pay');
      },
      closePopup(name) {
        if (!name) {
          this.popupName = ''
        } else {
          this[name] = false;
        }
      },
      async getPayWayList() {
        const url = `/retail/select/srvretail_pay_set_select?srvretail_pay_set_select`;
        const req = {
          "serviceName": "srvretail_pay_set_select",
          "colNames": ["*"],
        };
        uni.showLoading({
          title: "加载中"
        })
        const res = await this.$http.post(url, req)
        if (Array.isArray(res?.data?.data)) {
          this.paymentList = res?.data?.data.map((item) => {
            let timeUnique = `${Math.random()*1000}${new Date().getTime()}`;
            item.unique = timeUnique;
            if (item.pay_status == '启用') {
              item.disabled = false;
            } else {
              item.disabled = true;
            }
            if (item.pay_type == '会员卡') {
              item.label = '会员支付';
              item.image = '/static/icons/hyzf.png';
            } else if (item.pay_type == '现金') {
              item.label = '现金支付';
              item.image = '/static/icons/xjzf.png';
            } else if (item.pay_type == '支付宝') {
              item.label = '支付宝支付';
              item.image = '/static/icons/zfb.png';
            } else if (item.pay_type == '微信') {
              item.label = '微信支付';
              item.image = '/static/icons/wxzf.png';
            } else if (item.pay_type == '积分') {
              item.label = '积分支付';
              item.image = '/static/icons/wxzf.png';
            } else if (item.pay_type == '银联支付') {
              item.label = '银联支付';
              item.image = '/static/icons/hbzf.png';
            } else if (item.pay_type == '和包') {
              item.label = '和包支付';
              item.image = '/static/icons/hbzf.png';
            } else if (item.pay_type == '数字人民币') {
              item.label = '数字人民币支付';
              item.image = '/static/icons/hbzf.png';
            }
            return {
              ...item
            }
          })
          if (this.refundMode === true) {
            this.paymentList = this.paymentList.filter(item => ['会员支付', '现金支付'].includes(item.label))
          }
        }
        uni.hideLoading()
      },
      // 打开选择会员弹窗
      showMemberSelector() {
        this.$emit('showMemberSelector');
      },
      //打开现金支付弹窗
      openCashPayPopup() {
        this.showConfirmPayModal = true
        this.calcBillResult()
      },
      //关闭现金支付弹窗
      closeCashPayPopup() {
        this.onCashPay = false;
      },
      /**
       * @property {boolean} isCombined = [true|false] 是否为组合支付
       */
      useVipPay(isCombined = false) {
        this.showVipRefundModal = false
        this.showVipPayModal = false
        this.combinedPayment = false
        if (!this.refundMode && this.curMemberInfo?.account_protect === '验证码验证') {
          if (isCombined === true) {
            this.combinedPayment = true
          }
          this.getMemberDetail().then(detail => {
            this.sendVipPayCode(detail).then(res => {
              if (res === true) {
                this.popupName = 'validVipCode'
              }
            })
          })
        } else if (isCombined === true) {
          this.combinedPayment = true
          this.popupName = 'combinedPayment'
          this.calcBillResult()
        } else {
          this.createOrder({
            type: '会员余额'
          })
        }
      },
      async getMemberDetail() {
        const service = 'srvretail_member_info_noencryption_select'
        const url = `/retail/select/${service}`
        const req = {
          serviceName: service,
          colNames: ["*"],
          condition: [{
            colName: 'id',
            ruleType: 'eq',
            value: this.curMemberInfo.id
          }]
        }
        const res = await this.$http.post(url, req)
        if (Array.isArray(res?.data?.data) && res?.data?.data.length > 0) {
          this.memberDetail = res.data.data[0]
          return res?.data?.data[0]
        }
      },
      async sendVipPayCode(e) {
        let service = 'srvretail_member_sms_verification'
        service = 'srvls_send_note'
        const url = `/sso/operate/${service}`
        const req = [{
          "serviceName": service,
          "data": [{
            // "member_no": this.curMemberInfo?.menber_no,
            "mobile": e?.member_phone || this.curMemberInfo.member_phone,
            "type": 'member_card_consum'
            // sms_type:"member_card_consum"
          }]
        }]
        let res = await this.$http.post(url, req)
        if (res?.data?.state === 'SUCCESS') {
          uni.showToast({
            title: '验证码发送成功',
            // title: res?.data?.resultMessage || '验证码发送失败',
            icon: 'none'
          })
          return true
        } else {
          return false
          uni.showToast({
            title: '验证码发送失败',
            // title: res?.data?.resultMessage || '验证码发送失败',
            icon: 'none'
          })
        }
      },
      validVipPayCode() {
        if (this.vipPhoneCode && `${this.vipPhoneCode}`.length >= 4) {
          let service = 'srvretail_member_sms_verification'
          service = 'srvls_validate_note'
          const req = [{
            "serviceName": service,
            "data": [{
              "mobile": this.memberDetail?.member_phone || this.curMemberInfo.member_phone,
              "mobile_code": this.vipPhoneCode,
              "type": 'member_card_consum'
            }]
          }]
          const url = `/sso/operate/${service}`
          this.$http.post(url, req).then(res => {
            if (res?.data?.state === 'SUCCESS') {
              console.log(res.data);
              this.popupName = ''
              if (this.combinedPayment) {
                this.popupName = 'combinedPayment'
                this.calcBillResult()
              } else {
                this.createOrder({
                  type: "会员余额"
                })
              }
            } else {
              uni.showToast({
                title: res?.data?.resultMessage || '验证码不正确',
                icon: 'none'
              })

            }
          })
        } else {
          uni.showToast({
            title: '无效验证码',
            icon: 'error'
          })
        }
      },
      exitMember() {
        this.activeButton = ''
        this.$emit('exitMember')
        this.curCoupon = ''
        this.initCalcBillResult()
      },
      selectPayment(e) {
        /*
          现金支付
        */
        this.payWay = e;
        // if (this.curMemberInfo?.id && !this.activeButton) {
        // 	this.activeButton = '会员价';
        // }
        this.calcBillResult()
        if (e == '现金支付') {
          this.openCashPayPopup()
        } else if (e == '会员支付') {
          if (this.refundMode === true) {
            this.showVipRefundModal = true;
            return
          }
          const balance = this.curMemberInfo?.balance;
          const price = this.billResult?._order_amount
          if (balance <= 0) {
            uni.showToast({
              title: '会员余额不足',
              icon: 'none'
            })
            return
          }
          this.calcBillResult()
          if (balance < price) {
            this.combinedPayment = true
          }
          this.showVipPayModal = true
        } else if (e == "微信支付" || e == '支付宝支付' || e == "银联支付") {
          this.$emit("update:showWindow", true)
          this.codeInputValue = "";
        }
      },
      confirmPay(e) {
        /*
         * 现金支付支付接口
         */
        if (!e.inMoney) {
          uni.showToast({
            title: '请输入金额',
            icon: 'none'
          })
          return
        }
        this.onCashPay = false
        uni.showModal({
          title: '现金支付/线下支付',
          content: '请确认是否已完成支付!如点击确认,该订单将无法更换其他支付方式支付。',
          success: (res) => {
            if (res.confirm) {
              this.createOrder(e)
            }
          }
        })
      },
      cancel() {
        this.$emit('cancel')
      },
      autoCloseDialog(second = 3) {
        this.timeoutSecond = second
        const interval = setInterval(() => {
          this.timeoutSecond--
          if (this.timeoutSecond === 0) {
            clearInterval(interval)
            this.successPay()
          }
        }, 1000)
      },
      async payOrder(e) {
        let orderInfo = this.orderInfo;
        if (orderInfo?.order_no) {
          try {
            const payInfo = await payOrder({
              store_no: orderInfo.store_no,
              order_no: orderInfo.order_no,
              pay_type: '现金',
              member_no: orderInfo.member_no,
              amount: e.inMoney,
              remark: orderInfo.remark,
              "channel_source": "台式消费机", //订单来源
            })
            this.hasPay += Number(Number(e.inMoney).toFixed(2))
            if (payInfo) {
              this.onPaySuccess = true
              this.autoCloseDialog()
            }
            if (this.activeButton === '会员价') {
              uni.$emit('dataChange')
            }
            uni.hideLoading()
          } catch (e) {
            uni.hideLoading()
          }
        }
        return
      },
      async mobilePay() {
        this.createOrder2()
      },
      async createOrder2(e = {}) {

        if (this.curCoupon) {
          this.curCoupon = ''
        }
        uni.showLoading({
          title: '支付中...',
          mask: true
        })
        setTimeout(() => {
          uni.hideLoading()
        }, 15 * 1000)


        let passData = {
          "discount_type": '不优惠', // enum('不优惠','整单手动打折/改价','免单')
          "discount_mode": '无', // enum('无','打折','减免')
          "discount_reason": '',
        }

        let remark = this.remark || '';
        if (this.activeButton == '手动打折') {
          passData = {
            ...this.extraData.passData.disaccount
          };
          passData.discount_type = '整单手动打折/改价'
        } else if (this.activeButton == '免单') {
          passData.discount_type = '免单';

          passData.free_discount_amount = this.billResult?.free_discount_amount
          remark = this.extraData.freeOrder.remark;

        } else {
          passData.discount_type = '不优惠'
        }
        let discount_amount = '';

        let discount_mothed = []
        // set('会员优惠','促销-满额减现','促销-直接折扣','整单改价','积分抵扣','免单优惠')
        let discountArr = [{
          'key': 'free_discount_amount',
          'label': "免单优惠"
        }, {
          'key': 'cash_reduction_amount',
          'label': '抹零金额'
        }, {
          'key': 'discount_reduction_amount',
          'label': '整单改价'
        }, {
          'key': 'member_discount',
          'label': '会员优惠'
        }, {
          'key': 'discount_full_decrement',
          'label': '促销-满额减现'
        }, {
          'key': 'discount_direct',
          'label': '促销-直接折扣'
        }, {
          'key': 'integral_deduction',
          'label': '积分抵扣'
        }, {
          'key': 'goods_change_price',
          'label': '商品改价'
        }, {
          'key': 'coupon_discount',
          'label': '优惠券优惠'
        }]

        discountArr.forEach(item => {
          if (this.billResult[item.key]) {
            discount_mothed.push(item.label)
          }
        })

        discount_mothed = discount_mothed.toString()

        let data = {
          ...passData,
          "store_no": null,
          discount_mothed: discount_mothed,
          "discount_reduction_amount": Number(this.billResult?.discount_reduction_amount),
          "change_price": this.billResult?.change_price, //整单改价
          "cash_reduction_amount": this.billResult?.cash_reduction_amount || null, //抹零金额
          "member_discount": this.billResult?.member_discount || null, //会员优惠
          "free_discount_amount": this.billResult?.free_discount_amount || null, //免单优惠
          "order_total_amount": this.billResult?.order_total_amount,
          "discount_amount": this.billResult?.discount_amount,
          "order_amount": this.billResult?._order_amount,
          "use_integral": this.billResult?.use_integral, // 使用积分
          "integral_deduction": this.billResult?.integral_deduction, //积分抵扣金额
          "coupon_discount": this.billResult?.coupon_discount, //优惠券抵扣金额
          "coupon_no": this.billResult?.coupon_no, //优惠券编号
          "member_no": this.curMemberInfo?.menber_no || this.curMemberInfo?.member_no,
          "remark": remark,
          "sales_clerk": this.loginUser?.user_no, //收银员工号
          "sales_clerk_staff": this.curAssistant?.staff_no, //营业员工号
          "order_channel": "台式消费机", //订单来源
          "channel_source": "台式消费机", //订单来源
          "order_detail": this.billResult?.order_detail.map(item => {
            return {
              "goods_no": item.goods_no,
              "goods_type": item.goods_type,
              "goods_barcode": item.goods_barcode,
              "goods_num": Number(item.amount),
              "sale_price": item.sale_price,
              "subtotal_amount": item.subtotal_amount,
              'discount_amount': item.discount_amount,
              'ctual_amount': item.ctual_amount,
            }
          }),
          order_discounts: this.billResult?.order_discounts
        }

        if (this.refundMode === true) {
          data.order_type = '退款下单'
          data.order_detail = data.order_detail.map(item => {
            item.goods_num = -1 * Math.abs(item.goods_num)
            item.ctual_amount = -1 * Math.abs(item.ctual_amount)
            item.subtotal_amount = -1 * Math.abs(item.subtotal_amount)
            return item
          })
          data.order_amount = -1 * Math.abs(data.order_amount)
          data.order_total_amount = -1 * Math.abs(data.order_total_amount)
          data.order_pay.amount = -1 * Math.abs(data.order_pay.amount)
        }

        let _vip_pay_order_amount = 0
        if (data.member_no && this.combinedPayment === true && this.billResult?._vip_pay_order_amount &&
          this.billResult
          ?._vip_pay_amount) {
          // 组合支付
          _vip_pay_order_amount = this.billResult?._vip_pay_order_amount
          data.order_pays = [{
            "member_no": data.member_no,
            "pay_type": '会员余额',
            "amount": this.billResult?._vip_pay_amount,
            "remark": remark || this.remark || "",
            "channel_source": "台式消费机", //订单来源
          }]
        }

        if (this.loginUser?._tenant_info?.tenant_no) {
          data.store_no = this.loginUser?._tenant_info?.tenant_no
        }
        const orderInfo = await createOrder(data)
        this.hasPay = Number(Number(this.billResult?._order_amount || 0).toFixed(2))
        this.orderInfo = orderInfo

        if (orderInfo?.order_no) {
          data.order_no = orderInfo?.order_no;
          data.authCode = this.codeInputValue;
          data.amount = this.billResult?._order_amount || data.order_total_amount;

          if (this.payWay == '微信支付') {
            data.pay_way = 'wx_pay'
          } else if (this.payWay == '支付宝支付') {
            data.pay_way = 'ali_pay'
          } else if (this.payWay == '银联支付') {
            data.pay_way = 'union'
          }

          let returnData = await mobilePay(data, _vip_pay_order_amount);

          this.paying = false;
          this.$emit("update:showWindow", false);
          this.$emit("update:codePayString", null);
          if (returnData === 'USERPAYING') {
            uni.showLoading({
              title: '支付中...'
            })
            let state = await refreshOrderState(orderInfo?.order_no)
            uni.hideLoading()
            if (state?.message && state?.state !== true) {
              uni.showModal({
                title: '提示',
                content: state?.message,
                showCancel: false,
                success: (e) => {
                  if (e.confirm) {
                    this.autoCloseDialog()
                  }
                }
              })
              return
            } else {
              this.onPaySuccess = true
              this.autoCloseDialog()
            }
          } else if (returnData === true) {
            this.onPaySuccess = true
            this.autoCloseDialog()
          }
        }
        uni.hideLoading()
      },
      calcBillResult(type) {
        const ml_amount = Number(!isNaN(Number(this.ml_amount)) ? Number(this.ml_amount) : 0)

        let billResult = null
        let billResult2 = null
        let vipPriceList = this.$store?.state?.$goodsVipPriceList
        const activityList = this.$store?.state?.$activityList
        const integralSetting = this.$store?.state?.$integralSetting
        if (Array.isArray(vipPriceList) && Array.isArray(this.cartInfo.cart)) {
          vipPriceList = vipPriceList.filter(item => this.cartInfo.cart.find(e => e.goods_no === item.goods_no))
        }

        let vipPayAmount = 0

        if (this.combinedPayment === true && this.curMemberInfo?.balance) {
          vipPayAmount = this.curMemberInfo?.balance
        }

        let integralPayAmount = 0

        if (this.usedIntegral && this.usedIntegral > 0) {
          integralPayAmount = this.usedIntegral / this.integralSetting.satisfy_deduction_integral
        }

        // 使用优惠券
        const couponItem = this.couponList.find(item => item.id && item.id === this.curCoupon)

        if (type === 'coupon') {
          this.onSelectCoupon = false
          this.ml_amount = 0
        }

        const otherData = {
          discount_reason: this.extraData?.passData?.discount_reason || this.extraData?.freeOrder?.discount_reason,
          discount_reason_name: this.extraData?.disaccount?.disaccountTag?.discount_reason || this.extraData?.passData
            ?.discount_reason_name || this.extraData?.freeOrder?.remark,
          remark: this.extraData?.freeOrder?.remark || this.remark,
          store_no: this.tenantInfo?.tenant_no,
          channel_source: "台式消费机",
          sales_clerk: this.loginUser?.user_no,
          sales_clerk_staff: this.curAssistant?.staff_no,
        }

        switch (this.activeButton) {
          case '会员价':
            billResult2 = calcBillResult2(JSON.parse(JSON.stringify(this.cartInfo.cart)), this
              .curMemberInfo, {
                type: 'vip', // vip|discount|change|free|coupon 会员价、整单折扣、整单改价、免单、优惠券
                discountAmount: 0, // 整单减免金额/整单折扣比例（0-100）
                subtractPrice: ml_amount, //抹零金额
                vipPayAmount: vipPayAmount, //会员余额支付金额
                integralPayAmount: integralPayAmount, //积分抵扣金额
                use_integral: this.usedIntegral
              }, null,
              vipPriceList,
              activityList,
              integralSetting,
              otherData
            )
            break;
          case '免单':
            billResult2 = calcBillResult2(JSON.parse(JSON.stringify(this.cartInfo.cart)), this
              .curMemberInfo, {
                type: 'free', // vip|discount|change|free|coupon 会员价、整单折扣、整单改价、免单、优惠券
                discountAmount: 0, // 整单减免金额/整单折扣比例（0-100）
                subtractPrice: ml_amount, //抹零金额
                vipPayAmount: vipPayAmount, //会员余额支付金额
                integralPayAmount: integralPayAmount, //积分抵扣金额
              }, null,
              vipPriceList,
              activityList,
              integralSetting,
              otherData
            )
            break;
          case '手动打折':
            let discountAmount = this.extraData.disaccount.disaccountNumber
            let discountType = this.extraData.disaccount.discount_mode == '打折' ? 'discount' : 'change'
            billResult2 = calcBillResult2(JSON.parse(JSON.stringify(this.cartInfo.cart)), this
              .curMemberInfo, {
                type: discountType, // vip|discount|change|free|coupon 会员价、整单折扣、整单改价、免单、优惠券
                discountAmount: discountAmount, // 整单减免金额/整单折扣比例（0-100）
                subtractPrice: ml_amount, //抹零金额
                vipPayAmount: vipPayAmount, //会员余额支付金额
                integralPayAmount: integralPayAmount, //积分抵扣金额
              }, couponItem,
              vipPriceList,
              activityList,
              integralSetting,
              otherData
            )
            break;
          default:
            billResult2 = calcBillResult2(JSON.parse(JSON.stringify(this.cartInfo.cart)), this
              .curMemberInfo, {
                type: '', // vip|discount|change|free|coupon 会员价、整单折扣、整单改价、免单、优惠券
                promotionInfo: this.curPromotion,
                discountAmount: 0, // 整单减免金额/整单折扣比例（0-100）
                subtractPrice: ml_amount, //抹零金额
                vipPayAmount: vipPayAmount, //会员余额支付金额
                integralPayAmount: integralPayAmount, //积分抵扣金额
              }, couponItem,
              vipPriceList,
              activityList,
              integralSetting,
              otherData
            )
            break
        }

        this.billResult = billResult2
        if (billResult?.member_discount) {
          this.activeButton = '会员价'
        }
        this.$emit('setBillResult', billResult2, this.curPromotion)
        // this.$emit('setBillResult', billResult2, this.curPromotion,this.curCoupon)
      },
      async createOrder(e = {}) {
        if (this.curCoupon) {
          this.curCoupon = ''
        }
        if (e?.type === '会员余额') {
          this.showVipPayModal = false
        }
        uni.showLoading({
          title: '支付中...',
          mask: true
        })
        setTimeout(() => {
          uni.hideLoading()
        }, 15 * 1000)

        this.hideConfirmPayModal()

        if (this.orderInfo?.order_no) {
          this.payOrder((e))
          return
        }
        let passData = {
          "discount_type": '不优惠',
          "discount_mode": '无',
          "discount_reason": '',
        }

        let remark = this.remark || '';
        if (this.activeButton == '手动打折') {
          passData = {
            ...this.extraData.passData.disaccount,
            discount_reason_name: this.extraData?.disaccount?.disaccountTag?.discount_reason
          };
          passData.discount_type = '整单手动打折/改价'
        } else if (this.activeButton == '免单') {
          passData = {
            discount_reason: this.extraData.freeOrder?.discount_reason,
            discount_reason_name: this.extraData.freeOrder?.discount_reason_name || this.extraData?.freeOrder
              ?.remark
          };
          passData.discount_type = '免单';
          passData.free_discount_amount = this.billResult?.free_discount_amount
          // remark = this.extraData.freeOrder.remark;
        } else {
          passData.discount_type = '不优惠'
        }
        console.log(passData);
        // {
        //     "discount_reason": "202211090002",
        //     "remark": "",
        //     "discount_type": "免单",
        //     "free_discount_amount": -2464
        // }
        // {
        //   "discount_type": "整单手动打折/改价",
        //   "discount_mode": "打折",
        //   "discount_reduction_amount": "0.60",
        //   "discount_reason": "202211090001"
        // }

        let discount_mothed = []
        // set('会员优惠','促销-满额减现','促销-直接折扣','整单改价','积分抵扣','免单优惠')
        let discountArr = [{
            'key': 'free_discount_amount',
            'label': "免单优惠"
          }, {
            'key': 'cash_reduction_amount',
            'label': '抹零金额'
          }, {
            'key': 'discount_reduction_amount',
            'label': '整单改价'
          }, {
            'key': 'member_discount',
            'label': '会员优惠'
          }, {
            'key': 'discount_full_decrement',
            'label': '促销-满额减现'
          }, {
            'key': 'discount_direct',
            'label': '促销-直接折扣'
          }, {
            'key': 'integral_deduction',
            'label': '积分抵扣'
          },
          {
            'key': 'coupon_discount',
            'label': '优惠券优惠'
          }
        ]

        discountArr.forEach(item => {
          if (this.billResult[item.key]) {
            discount_mothed.push(item.label)
          }
        })
        discount_mothed = discount_mothed.toString()
        let data = {
          ...passData,
          "store_no": null,
          discount_mothed: discount_mothed,

          "change_price": this.billResult?.change_price, //整单改价减免金额
          "cash_reduction_amount": this.billResult?.cash_reduction_amount || null, //抹零金额
          "member_discount": this.billResult?.member_discount || null, //会员优惠金额
          "free_discount_amount": this.billResult?.free_discount_amount, // 免单优惠金额
          "order_total_amount": this.billResult?.order_total_amount,
          "discount_reduction_amount": this.billResult?.discount_reduction_amount || 0, // 折扣/减免金额
          "change_price": this.billResult?.change_price, //整单改价

          // 促销活动
          "discount_full_decrement": this.billResult?.discount_full_decrement || 0, // 促销-满额减现
          "discount_direct": this.billResult?.discount_direct || 0, //	促销-直接折扣

          "discount_amount": this.billResult?.discount_amount || null,
          "order_amount": this.billResult?._order_amount || 0,
          // 积分
          "use_integral": this.billResult?.use_integral, // 使用积分
          "integral_deduction": this.billResult?.integral_deduction, //积分抵扣金额

          //优惠券
          "coupon_discount": this.billResult?.coupon_discount, //优惠券抵扣金额
          "coupon_no": this.billResult?.coupon_no, //优惠券编号

          "member_no": this.curMemberInfo?.menber_no,
          "remark": passData?.remark || remark || null,
          "sales_clerk": this.loginUser?.user_no, //收银员工号
          "sales_clerk_name": this.loginUser?.real_name, //收银员姓名
          "sales_clerk_staff": this.curAssistant?.staff_no, //营业员工号
          "order_channel": "台式消费机", //订单来源
          "channel_source": "台式消费机", //订单来源
          "order_detail": this.billResult?.order_detail.map(item => {
            return {
              "goods_no": item.goods_no,
              "goods_type": item.goods_type,
              "goods_barcode": item.goods_barcode,
              "goods_num": Number(item.amount),
              "sale_price": item.sale_price,
              "subtotal_amount": item.subtotal_amount,
              "discount_amount": item.discount_amount || 0, //优惠金额
              "ctual_amount": item.ctual_amount || 0, //实收金额
            }
          }),
          order_discounts: this.billResult?.order_discounts
        }

        let _vip_pay_order_amount = 0
        if (data.member_no && this.combinedPayment === true && this.billResult?._vip_pay_order_amount &&
          this.billResult
          ?._vip_pay_amount) {
          // 组合支付
          _vip_pay_order_amount = this.billResult?._vip_pay_order_amount
          data.order_pays = [{
              "pay_type": "现金",
              "member_no": data.member_no,
              "amount": this.billResult?._vip_pay_order_amount,
              "remark": remark || this.remark || "",
              "channel_source": "台式消费机", //订单来源
            },
            {
              "pay_type": '会员余额',
              "member_no": data.member_no,
              "amount": this.billResult?._vip_pay_amount,
              "remark": remark || this.remark || "",
              "channel_source": "台式消费机", //订单来源
            }
          ]
        } else if (this.payWay == '现金支付') {
          data.order_pay = {
            "pay_type": "现金",
            "member_no": data.member_no,
            "amount": this.billResult?._order_amount,
            "remark": remark || this.remark || "",
            "channel_source": "台式消费机", //订单来源
          }
        } else {
          data.order_pay = {
            "pay_type": e?.type || "现金",
            "member_no": data.member_no,
            "amount": this.billResult?._order_amount,
            "remark": remark || this.remark || "",
            "channel_source": "台式消费机", //订单来源
          }
        }

        if (this.refundMode === true) {
          data.order_type = '退款下单'
          data.order_detail = data.order_detail.map(item => {
            item.goods_num = -1 * Math.abs(item.goods_num)
            item.ctual_amount = -1 * Math.abs(item.ctual_amount)
            item.subtotal_amount = -1 * Math.abs(item.subtotal_amount)
            return item
          })
          data.order_amount = -1 * Math.abs(data.order_amount)
          data.order_total_amount = -1 * Math.abs(data.order_total_amount)
          data.order_pay.amount = -1 * Math.abs(data.order_pay.amount)
        }


        if (this.loginUser?._tenant_info?.tenant_no) {
          data.store_no = this.loginUser?._tenant_info?.tenant_no
        }
        debugger
        const orderInfo = await createOrder(data)
        this.hasPay = Number(Number(this.billResult?._order_amount).toFixed(2))

        this.orderInfo = orderInfo

        console.log(orderInfo);

        if (orderInfo?.order_no) {
          const payData = {
            order_no: orderInfo?.order_no,
            pay_way: "",
            authCode: this.codeInputValue,
            member_no: data.member_no,
            amount: _vip_pay_order_amount || this.billResult?._order_amount,
            remark: data.remark
          }

          if (['微信支付', '支付宝支付', '银联支付'].includes(this.payWay)) {
            if (this.payWay == '微信支付') {
              data.pay_way = 'wx_pay'
            } else if (this.payWay == '支付宝支付') {
              data.pay_way = 'ali_pay'
            } else if (this.payWay == '银联支付') {
              data.pay_way = 'union'
            }
            let returnData = await mobilePay(data, _vip_pay_order_amount);
            this.paying = false;
            this.$emit("update:showWindow", false);
            this.$emit("update:codePayString", null);
            if (!returnData) {
              return
            }
          }
          this.onPaySuccess = true
          this.autoCloseDialog()
        }

        uni.hideLoading()
      }
    },
  }
</script>

<style lang="scss" scoped>
  .ml-content {
    .row {
      line-height: 2.2rem;
      color: rgba(51, 51, 51, 0.85);
      border-bottom: 1px solid whitesmoke;
      padding: 1rem 2rem;
      font-size: 1.4rem;
      font-weight: 600;
      cursor: pointer;

      &.no-border {
        border-bottom: 0px;
      }
    }
  }

  .ml-box {
    .zb_tooltip__popper {
      padding: 0px !important;
    }
  }

  .bill-content-wrap {
    width: 100%;
    height: 100%;
    padding: 0 2rem 1rem;
    background-color: #F5F5F5;
    display: flex;
    position: relative;

    .cancel-button {
      position: absolute;
      top: 50%;
      left: -30rem;
      // width: ;
      // font-size: 5rem;
      // font-weight: bold;
      // width: 6rem;
      // height: 6rem;
      // line-height: 6rem;
      text-align: center;
      // border-radius: 50%;
      // border: 2px solid #333;
    }
  }

  .bill-title {
    display: flex;
    width: 100%;
    justify-content: space-between;
    font-size: $retail-font-size-sm;
    font-weight: 700;
    padding: 2rem 0 2rem;

    &.padding-top-0 {
      padding-top: 0;
    }
  }

  .bill-content-left {
    width: 33vw;
    height: 100%;
    padding: 0 2rem;
    border-right: 1px solid #f1f1f1;
    background-color: #fff;
    border-radius: 1rem 0 0 1rem;
    display: flex;
    flex-direction: column;

    .vip-card {
      display: flex;
      justify-content: space-between;
      width: 100%;
      // height: 8rem;
      padding: 1.5rem 3.4rem 1.5rem 2rem;
      color: #634B2E;
      border-radius: 1rem;
      background: #fdefdb;
      background: linear-gradient(217.39deg, #F5B45F4C 0%, #FCDDB14C 54.86%, #FADBAF4C 80.56%, #F7C57E4C 100%);
      margin-top: 1rem;
      flex-wrap: wrap;

      .vip-card-left-bottom {
        width: 100%;
        display: flex;
        font-size: 1.6rem;
        justify-content: space-between;
      }

      .vip-card-left {
        display: flex;
        align-items: center;
        font-size: $retail-font-size-sm;

        .vip-icon {
          width: 4.8rem;
          height: 4.8rem;
          margin-right: 4rem;
        }
      }

      .vip-card-right {
        display: flex;
        align-items: center;
        font-size: $retail-font-size-xs;

        .icon {
          width: 2.8rem;
          height: 2.8rem;
          margin-left: 2rem;
        }
      }

    }

    .change-price-box {
      // padding-top: 2rem;
    }
  }


  .bill-content-right {
    background-color: #fff;
    border-radius: 0 1rem 1rem 0;
    flex: 1;
    height: 100%;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;

    &.center {
      border-radius: 0;
      border-right: 1px solid #f1f1f1;
    }
  }


  .coupon-code-box {
    display: flex;
    border: 1px solid $retail-color-primary;
    border-radius: 1rem;
    height: 7rem;
    width: 100%;
    align-items: center;
    font-size: $retail-font-size-sm;
    overflow: hidden;

    .coupon-code-input {
      padding: 0 2.8rem;
      background-color: #fff;
      width: 48rem;
      height: 3.5rem;
      font-size: $retail-font-size-sm;
    }

    .coupon-code-icon {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100%;
      background-color: $retail-color-primary;
      color: #fff;
    }
  }

  .payment-grid {
    display: flex;
    flex-wrap: wrap;

    // justify-content: space-between;
    .payment-item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 20%;
      // padding: 1rem;
      font-size: $retail-font-size-sm;

      &:first-child {
        justify-content: flex-start;
      }

      &:last-child {
        justify-content: flex-end;
      }

      &.disabled {
        filter: grayscale(100%);
      }

      &.active {
        background-color: $retail-color-primary;
        color: #fff;
        border-radius: 1rem;
      }

      image {
        border-radius: 1rem;
        width: 8.6rem;
        height: 8.6rem;
      }

      .payment-item-label {
        padding: 1rem;
        font-size: 2rem;
      }
    }
  }

  .detail-list {
    font-size: $retail-font-size-sm;

    .detail-list-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 0 1rem;

      &.text-lg {
        font-size: 3.6rem;
      }

      &.border-top {
        border-top: 1px dashed #ccc;
        padding-top: 1rem
      }

      .price {
        font-weight: 700;
        font-size: $retail-font-size-base;
      }
    }
  }

  .custom-center-popup {
    &.top {
      ::v-deep .u-transition {
        z-index: 19999 !important;
      }
    }

    .selector-view {
      min-width: 50vw;
    }

    ::v-deep .u-popup__content__close--top-right {
      right: 3rem;
      top: 3rem;
    }
  }

  // .button.active {
  //   border: 1px solid $retail-color-primary;
  //   background-color: ;
  // }

  .success-pay {
    width: 55rem;
    min-height: 70rem;
    padding: 4rem;
    font-size: 2.4rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;

    .button-box {
      width: 100%;
    }

    .title {
      font-weight: 700;
      font-size: 3.6rem;
      line-height: 4rem;
    }

    .image {
      width: 16.8rem;
      height: 16.8rem;
      margin: 1.5rem 0;
    }

    .pay-amount {
      font-size: 3.6rem;
      line-height: 5rem;
      color: #FF5733;
      padding: 1rem;
    }

    .bottom {
      border-top: 1px solid #E5E5E5;
      // margin: 2rem 0;
      padding-top: 1rem;
      min-width: calc(100% - 4rem);

      &-item {
        padding: 1rem;
        display: flex;
        justify-content: space-between;

        .money {
          // min-width: 10rem;
          // text-align: left;
        }
      }
    }

    .button {
      margin-top: 3rem;
    }
  }

  .memeber-price-confirm {
    display: flex;
    flex-direction: column;

    .container {
      flex: 1;
    }
  }

  .custom-u-modal {
    flex: 0;

    ::v-deep .vip-code-input {
      width: 100%;
      text-align: center;

      .uni-input-wrapper,
      .uni-input-placeholder,
      input {
        font-size: 2.4rem;
      }

      .hint {
        font-size: 1.8rem;
        margin-top: 2rem;
      }
    }

    ::v-deep .u-modal {
      // width: 35vw !important;

      .u-modal__title {
        font-size: 3rem;
        color: #333;
      }

      .u-modal__content {
        font-size: 3rem;
        padding: 4rem !important;
        min-height: 15vh;

        .u-modal__content__text {
          font-size: 3rem;
          line-height: 4rem;
        }
      }

      .u-modal__button-group__wrapper {
        height: 7rem;

        .u-modal__button-group__wrapper__text {
          font-size: 3rem;
        }

        &.u-modal__button-group__wrapper--cancel {}
      }
    }
  }

  .combinedPayment {
    ::v-deep {
      .u-transition {
        z-index: 10 !important;
      }
    }
  }

  .combine-payment {
    min-width: 60vw;
    min-height: 40vh;
    border-top: 1px solid #E5E5E5;
    display: flex;
    flex-wrap: wrap;
    padding: 2rem;

    &-left {
      flex: 1;
    }

    &-right {
      width: 20vw;
      padding: 2rem;
      min-width: 300px;
      font-size: 2.4rem;
      border-left: 1px solid #e5e5e5;

      .title {
        font-size: 2.8rem;
        font-weight: bold;
        margin-bottom: 2rem;
      }

      .pay-result-item {
        padding: 1rem 0;
        display: flex;
        justify-content: space-between;

        &.border-top-dashed {
          border-top: 1px dashed #e5e5e5;
          padding-top: 2rem;
          margin-top: 1rem;
        }
      }
    }

    &-item {
      // width: 10vw;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 2rem;
      font-size: 2.4rem;
      width: 120px;

      .image {
        width: 100px;
        height: 100px;
        margin-bottom: 1rem;
      }

    }

    &-top {
      text-align: left;
    }

    &-center {
      display: flex;
      justify-content: flex-start;
    }

    &-bottom {
      width: 100%;
      text-align: center;
      padding: 4rem 0;
      margin-top: 2rem;
      border-top: 1px solid #e5e5e5
    }
  }

  .padding {
    padding: 2rem;
  }

  .padding-lg {
    padding: 4rem;
  }

  .margin-left {
    margin-left: 2rem;
  }

  .flex-column {
    flex-direction: column;
  }

  .coupon-list-sub {
    width: 30vw;
    margin: 0 auto;
    margin-bottom: 1rem;

    ::v-deep .u-subsection {
      height: 6rem;

      .u-subsection__item {
        .u-subsection__item__text {
          font-size: 2.4rem !important;
        }
      }
    }


  }

  .coupon-list {
    font-size: 2.4rem;
    width: 40vw;
    height: 60vh;

    &-box {
      width: 100%;

    }

    &-item {
      width: 80%;
      margin-right: 1.5rem;
      border-radius: 1rem;
      border: 1px solid #eee;
      overflow: hidden;
      margin: 0 auto;
      margin-bottom: 1rem;

      &.active {
        border-color: $retail-color-primary;

        .top {
          background-color: #DEF2EA;
        }
      }

      .top {
        padding: 2rem;
        // background-color: #DEF2EA;
        height: 12rem;
        display: flex;
        flex-direction: column;
        justify-content: center;

        .type {
          font-size: 2rem;
          padding: 1rem 0 0;
          display: flex;
          justify-content: space-between;
        }

        .title {
          display: flex;
          font-weight: bold;
          justify-content: space-between;

          .right {
            color: $retail-color-primary;
          }
        }
      }

      .bottom {
        font-size: 2rem;
        color: #A6A6A6;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;

        .btn {
          width: 6rem;
          height: 4rem;
          line-height: 4rem;
          border-radius: 2rem;
          background: #F5F5F5;
          text-align: center;
          font-size: 2rem;
        }
      }
    }
  }
</style>
